#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#include "my_string.h"

#define STRING_SIZE_MAX		256

char *my_strcat(char *l, char *n)
{
	char *result = l;
	if(l == NULL || n == NULL){
		return NULL;
	}
	
	while(*l)
	{
		l++;
	}
	
	while(*l++ = *n++)
	{
	}
	
	return result;
}

char *my_strstr(const char *src, const char *dest)
{
	int n = 0;
	
	if (*dest) {
		while(*src){
			for (n = 0; *(src +n) == *(dest + n); n++){
				if (!*(dest + n + 1))
					return (char *)src;
			}
			
			src++;
		}
		return NULL;
	}
	else
		return (char *)src;
}

int main()
{
	char l[STRING_SIZE_MAX] = {'H','e','l','l','o','O','o','\0',};
	//char n[STRING_SIZE_MAX] = {' ','W','o','r','l','d','\n','\0'};
	char n[STRING_SIZE_MAX] = {'e','l','l','o','\0'};
	printf("start addr of l is %s\n", l);
	printf("start addr of n is %s\n", n);
	//printf("after strcat, the string is %s\n", my_strcat(l, n));
	printf("result is %s\n", my_strstr(l, n));
}
